import { defineStore } from 'pinia' //引入pinia=

//获取地址栏参数
function getUrlParams() {
	const url = window.location.hash.substring(2);
	let paramsObj = new Object();
	if (url.indexOf("?") != -1) {
		let str = url.substr(1);
		str = str.split("&");
		for (let i = 0; i < str.length; i++) {
		paramsObj[str[i].split("=")[0]] = decodeURI(str[i].split("=")[1]);
		}
	}
	return paramsObj;
}
export const useMainStore = defineStore("main",{
	state: () => {
		return  ({

			userid: getUrlParams().userid,//从点播后台查看获取
			secretkey: getUrlParams().secretkey,//从点播后台查看获取
            writeToken: getUrlParams().writeToken,//从点播后台查看获取
		}) //为了避免出错，返回的值用()包起来
	},
    getters: {

    },
    actions: {

    }
})